package com.magist.manage.util;

import com.magist.core.helper.SessionHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 业务编码生成工具
 *  从redis中取自增
 */
@Component
public class BusinessCodeGenter {


    @Autowired
    private SessionHelper sessionHelper;

    /**
     * 生成业务编号,从100001起,自增
     * @param businessCode
     * @return
     */
    public String genBusinessCode(String businessCode) {
        Long id = sessionHelper.generateAutoIncrId(businessCode);
        Long base = 100000L;
        Long total = base + id;
        return businessCode + total;
    }
}
